<?php
require 'basics.php';

$url = '/';
$err = 0;

$database = Database::getInstance();

function login_redirect($url, $msg){
	//if($msg) $url .= '?login_msg='.$msg;
	header('location: '.$url);
	echo '<input type="hidden" name="login_msg" value=\"'.$msg.'\"><a href="'.htmlspecialchars($url).'">redirect</a>';
	exit;
}

//set up the redirect
if(isset ($_REQUEST['redirect'])){
	$url = preg_replace('/[\?\&].*/', '', $_REQUEST['redirect']);
	if($url == '') $url = '/';
}